package cn.edu.ctbu.firsthello.dao;

import cn.edu.ctbu.firsthello.domain.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface StudentRepository  extends JpaRepository<Student,Integer> {


    public List<Student> findByNameLike(String name);


    @Query("from tb_student  o where o.age = (select max(age) from tb_student)")
    public  List<Student> findByMaxAge();


    @Query("from tb_student o where o.name like :name and o.score = :score ")
    public List<Student> findByNameScore(@Param("name") String name,@Param("score")  Integer score);



}
